home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-08-25 | 1.6 KB | 37 lines | [TEXT/ToyS] |
- set tWhatToRestore to lastASitem(":", (path to me as string))
- set tWhereToRestore to choose folder with prompt "Select a volume and press 'Choose'"
-
- launch application "Apple Software Restore"
- --NOTE! Launching an application from AppleScript is different than opening it with a
- --"Tell application" line. When you "launch" ASR 1.3.2 from AppleScript, this tells ASR
- --to enter "background" mode. This replaces the need for the "LaunchASR" OSAX
-
- tell application "Apple Software Restore"
- with timeout of 1000000 seconds
- try
- Restore tWhatToRestore to ¬
- tWhereToRestore placing in entire volume ¬
- preprocess erasing disk ¬
- copying everything ¬
- warning true ¬
- barber pole speed 10 with checksum, removing unwanted files and erasing on failure
- on error tErrorMessage number tErrorNumber
- display dialog ("Error: " & "[" & tErrorMessage & "]" & ", [" & tErrorNumber & "]")
- end try
- end timeout
- quit
- end tell
- --Note on the first parameter to the 'Restore' command: If you pass in a pathname or alias, ASR
- --will assume it's a single image and restore it (if present). If you simply pass in a string
- --(as in the example), ASR will look in the 'Configurations' folder for an image with that name.
- --If the 'Configurations' folder is not present, ASR will look in the same folder as itself
- --for an image with that name.
-
- on lastASitem(delim, theText)
- -- returns the portion of <theText> that follows the last <delim>
- set theText to theText as string
- if delim is in theText then
- set theText to lastASitem(delim, (characters ((offset of delim in theText) + 1) through (length of theText) of theText))
- end if
- return theText
- end lastASitem